package userHelp

import (
	myredis "common/redis"
	"fmt"
	"time"
)

// 玩家汇总数据
type TblMemberLottery struct {
	Uid            string  `json:"uid" db:"uid" cbor:"uid"`
	Username       string  `db:"username" json:"username"` // 用户名
	LotteryDeposit float64 `json:"lottery_deposit" db:"lottery_deposit" cbor:"lottery_deposit"`
	LastDepostTime int     `json:"last_deposit_time" db:"last_deposit_time" cbor:"last_deposit_time"`
}

var g_tbl_member_lottery = "tbl_member_lottery:"

func AddLotteryDeposit(Uid string, AddValue float64) {
	LoadUserToRedis(Uid)
	myredis.AddUserFieldValueByFloat64(Uid, g_tbl_member_lottery+"lottery_deposit", AddValue)

	LastDepostTime := fmt.Sprintf("%d", time.Now().Unix())
	myredis.SetUserFieldValue(Uid, g_tbl_member_lottery+"last_deposit_time", LastDepostTime)
}
func GetLotteryDeposit(Uid string) float64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldFloat64(Uid, g_tbl_member_lottery+"lottery_deposit")
}
func GetLastDepostTime(Uid string) int64 {
	LoadUserToRedis(Uid)
	return myredis.GetUserFieldInt64(Uid, g_tbl_member_lottery+"last_deposit_time")
}
